package com.study.leetcode;
//https://leetcode-cn.com/problems/palindrome-linked-list/
public class Solution_234 {
    public boolean isPalindrome(ListNode head) {
        StringBuilder direct = new StringBuilder();
        StringBuilder reverse = new StringBuilder();
        while (head != null) {
            direct.append(head.val);
            reverse.insert(0, head.val);
            head = head.next;
        }
        return direct.toString().equals(reverse.toString());
    }
}
